import React from "react";
import {
  HandPayCircleOutline,
  MailFill,
  UnorderedListOutline,
  UserOutline,
} from "antd-mobile-icons";
import { TabBar } from "antd-mobile";
import { useLocation, useNavigate } from "react-router-dom";
function Index() {
  const location = useLocation();
  const { pathname } = location;
  const nav=useNavigate()
  const tabs = [
    {
      key: "/shouye",
      title: "就医",
      icon: <HandPayCircleOutline />,
    },
    {
      key: "/xiaoxi",
      title: "消息",
      icon: <MailFill />,
    },
    {
      key: "/my",
      title: "我的",
      icon: <UserOutline />,
    },
  ];
  const setRouteActive = (value) => {
    // console.log(value);
    nav(value)
  };
  return (
    <div>
      <TabBar activeKey={pathname} onChange={(value) => setRouteActive(value)}>
        {tabs.map((item) => (
          <TabBar.Item key={item.key} icon={item.icon} title={item.title} />
        ))}
      </TabBar>
    </div>
  );
}

export default Index;
